# coding=utf-8
class ConstAssignError(Exception): pass

class _const(object):
    def __init__(self, *args, **kwargs):
        super(_const, self).__init__(*args, **kwargs)
        self.a = 1
        self.b = self.__fuck_test
        
    def __fuck_test(self):
        print 'fuck'

    def __setattr__(self, k, v):
        if k in self.__dict__:
            raise ConstAssignError, "Can't rebind const (%s)" % k
        else:
            self.__dict__[k] = v
            
    def __getattr__(self, k, v):
        pass

def _test():
    const = _const()
    const.A = 1
    print const.A

    const.A = 1


if __name__ == '__main__':
    # _test()
    a = _const()
    print a.__dict__
    a.b()